package com.example.Service;

import com.example.Dao.StudentMapper;
import com.example.Domain.Student;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class StudentService {

    @Autowired
    private StudentMapper studentMapper;


    public int AddStudent(Student student) {
        return studentMapper.AddStudent(student);
    }

    // 删除学生
    public int DeleteStudent(int id) {
        return studentMapper.DeleteStudent(id);
    }

    // 查询单个学生
    public Student SelectStudentById(String username) {
        return studentMapper.SelectStudentById(username);
    }

    // 查询所有学生
    public List<Student> SelectAllStudent() {
        return studentMapper.SelectAllStudent();
    }

    // 根据用户名查询学生
    public Student SelectStudentByUsername(String username) {
        return studentMapper.SelectStudentByUsername(username);
    }
}